package com.wyg.epredisstarter.config;

import com.wyg.epredisstarter.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @Author: WangYongGan
 * @Date: 2022/5/19 18:55
 * @Description 集成redis，支持快速启动，配置key prefix,自定义redisConfig
 */

@Configuration
@Import(CacheConfig.class)
@EnableConfigurationProperties(RedisConfigProperties.class)
@Slf4j
public class AutoConfig {
    @Bean
    public RedisUtil redisUtil(RedisTemplate<String, Object> redisTemplate) {
        log.info("redisUtil配置成功");
        return new RedisUtil(redisTemplate);
    }
}
